/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.graphic;

import Modelos.ModeloTabuleiro;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JFrame;


public class FinalFrame extends JFrame implements Observer {

    ModeloTabuleiro m;
    Pontuacao pointsFinal;

    public FinalFrame(ModeloTabuleiro m) {
        this.m = m;

        setTitle("Final do Jogo!");
        setSize(675, 443);
        setPreferredSize(new Dimension(675, 443));
        setResizable(false);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        pointsFinal = new Pontuacao(m);
        pointsFinal.setVisible(true);
        setVisible(true);
        fazLayout();
    }

    final void fazLayout() {
        Container cp = getContentPane();
        cp.setLayout(new BorderLayout());
        cp.add(pointsFinal, BorderLayout.CENTER);
        cp.validate();
    }

    @Override
    public void update(Observable o, Object arg) {
        repaint();
    }
}
